/**
 * Created with IntelliJ IDEA.
 * User: jiang.li
 * Date: 13-10-24
 * Time: 上午10:54
 * To change this template use File | Settings | File Templates.
 */

window.AllDocCrt = function ($rootScope, $scope) {

    //获取设备ID
    var _ctrl_device_id = top.CurrentDeviceLog;
    //查询参数组装
    $scope.queryParams || ( $scope.queryParams = {});
    $scope.queryParams.pageSize = 10;
    $scope.queryParams.deviceId = _ctrl_device_id;

    //加载数据函数
    var loadData = function () {
        $.ajax({
            url: '/services/api/common/access_log/queryAll',
            type: "GET",
            data: $scope.queryParams,
            dataType: "json",
            success: function (data) {
                $scope.pageData = pageToObj(data);
                $scope.NORESULT = '没有查询到数据';
                applyAngularScope($rootScope, $scope);
            }
        });
    }

    //分页查询
    $scope.goPage = function (pageNo, className) {
        if (className == 'disabled') {
            return;
        }
        $scope.queryParams.pageNo = pageNo;
        loadData();
    }

    //首次加载数据
    loadData();
}